home *** CD-ROM | disk | FTP | other *** search
-
- package sub_arctic.test;
-
- /* import various pieces of the sub_arctic toolkit that we need */
- import sub_arctic.lib.*;
- import sub_arctic.input.*;
- import sub_arctic.constraints.std_function;
-
-
- public class vis_test extends interactor_applet
- implements callback_object {
-
- public base_parent_interactor par;
- public interactor head;
-
- /* initialization of sub_arctic interface when applet starts */
- public void build_ui(base_parent_interactor top)
- {
- par = new base_parent_interactor(0,0);
- par.set_w_constraint(std_function.eq(PARENT.W()));
- par.set_h_constraint(std_function.eq(PARENT.H()));
- top.add_child(par);
-
- toggle on_off = new toggle(10,10, this);
- par.add_child(on_off);
-
- label c = new label("Press ");
- c.set_visible_constraint(std_function.eq(PREV_SIBLING.PART_A()));
- c.set_enabled_constraint(std_function.eq(PREV_SIBLING.PART_A()));
- c.set_x_constraint(std_function.offset(PARENT.X(), 20));
- c.set_y_constraint(std_function.centered(PARENT.H(), 0));
- par.add_child(c);
- head = c;
-
- c = new label("the");
- c.set_visible_constraint(std_function.eq(PREV_SIBLING.VISIBLE()));
- c.set_enabled_constraint(std_function.eq(PREV_SIBLING.ENABLED()));
- c.set_x_constraint(std_function.offset(PREV_SIBLING.X2(), 2));
- c.set_y_constraint(std_function.eq(PREV_SIBLING.Y()));
- par.add_child(c);
-
- c = new label("toggle");
- c.set_visible_constraint(std_function.eq(PREV_SIBLING.VISIBLE()));
- c.set_enabled_constraint(std_function.eq(PREV_SIBLING.ENABLED()));
- c.set_x_constraint(std_function.offset(PREV_SIBLING.X2(), 2));
- c.set_y_constraint(std_function.eq(PREV_SIBLING.Y()));
- par.add_child(c);
-
- c = new label("to change visibility...");
- c.set_visible_constraint(std_function.eq(PREV_SIBLING.VISIBLE()));
- c.set_enabled_constraint(std_function.eq(PREV_SIBLING.ENABLED()));
- c.set_x_constraint(std_function.offset(PREV_SIBLING.X2(), 2));
- c.set_y_constraint(std_function.eq(PREV_SIBLING.Y()));
- par.add_child(c);
-
- c = new label(" (this tests enabled too...)");
- c.set_visible_constraint(std_function.eq(PREV_SIBLING.ENABLED()));
- c.set_enabled_constraint(std_function.eq(PREV_SIBLING.ENABLED()));
- c.set_x_constraint(std_function.offset(PREV_SIBLING.X2(), 2));
- c.set_y_constraint(std_function.eq(PREV_SIBLING.Y()));
- par.add_child(c);
-
- h_slider s = new h_slider(10,10, 200, 0,100, 50, 1, 10, this);
- s.set_y_constraint(std_function.eq(PREV_SIBLING.Y2()));
- par.add_child(s);
-
- c = new label("follows slider value (0..100)");
- c.set_x_constraint(std_function.offset(PREV_SIBLING.PART_A(), 10));
- c.set_y_constraint(std_function.offset(PREV_SIBLING.Y2(), 5));
- par.add_child(c);
-
- v_slider s2 = new v_slider(10,10, 80, 0,150, 25, 1, 10, this);
- s2.set_x_constraint(std_function.offset(PREV_SIBLING.X2(), 10));
- par.add_child(s2);
-
- c = new label("follows (0..150)");
- c.set_x_constraint(std_function.offset(PREV_SIBLING.X2(), 10));
- c.set_y_constraint(std_function.offset(PREV_SIBLING.PART_A(), 10));
- par.add_child(c);
-
- h_scrollbar s3 = new h_scrollbar(0,0, 80, -1,3, 0, 0.25, 1,1, this);
- s3.set_x_constraint(std_function.eq(PREV_SIBLING.X()));
- s3.set_y_constraint(std_function.offset(PREV_SIBLING.Y2(),10));
- par.add_child(s3);
-
- toggle t2 = new toggle(0,0,this);
- t2.set_x_constraint(std_function.offset(PREV_SIBLING.X2(),10));
- t2.set_y_constraint(std_function.eq(PREV_SIBLING.Y()));
- t2.set_part_a_constraint(std_function.eq(PREV_SIBLING.PART_A()));
- t2.set_enabled(false);
- par.add_child(t2);
-
- h_scrollbar s4 = new h_scrollbar(10,0, 80, -10, 110, 0,0.25,1,10, this);
- s4.set_y_constraint(std_function.far_edge_just(PARENT.Y2(), 5));
- par.add_child(s4);
-
- h_scrollbar s5 = new h_scrollbar(0,0, 80, 0, 100, 0,0.25,1,10, this);
- s5.set_x_constraint(std_function.offset(PREV_SIBLING.X2(), 10));
- s5.set_y_constraint(std_function.eq(PREV_SIBLING.Y()));
- s5.set_part_b_constraint(std_function.eq(PREV_SIBLING.PART_A()));
- par.add_child(s5);
-
- v_scrollbar s6 = new v_scrollbar(0,0, 80, 0, 100, 0,0.25,1,10, this);
- s6.set_x_constraint(std_function.offset(PREV_SIBLING.X2(), 50));
- s6.set_y_constraint(std_function.offset(PREV_SIBLING.Y(), -75));
- s6.set_part_b_constraint(std_function.eq(PREV_SIBLING.PART_B()));
- par.add_child(s6);
-
- v_scrollbar s7 = new v_scrollbar(0,0, 80, 0, 100, 0,0.25,1,10, this);
- s7.set_x_constraint(std_function.offset(PREV_SIBLING.X2(), 10));
- s7.set_y_constraint(std_function.offset(PREV_SIBLING.Y(), 0));
- s7.set_part_b_constraint(std_function.eq(PREV_SIBLING.PART_B()));
- par.add_child(s7);
- }
-
- /* handle callback from the button. */
- public void callback(interactor from, event evt, int cb_num, Object cb_parm)
- {
- // now done with constraints...
- }
- };
-
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-